package com.hps.ssh.service.impl;

import com.hps.ssh.dao.IClassDao;
import com.hps.ssh.dao.IStudentDao;
import com.hps.ssh.entity.Clazz;
import com.hps.ssh.entity.Student;
import com.hps.ssh.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class StudentServiceImpl implements IStudentService{

    @Autowired
    private IStudentDao studentDao;

    @Autowired
    private IClassDao classDao;

    @Override
    public void add(Student student) {
        Clazz clazz = classDao.findById(8);
        student.setClazz(clazz);
        studentDao.add(student);
    }
}
